UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'owaG3cV7DvmRNfNq/iV1jcC7ETlt0vO5w5nxee2cnP8='
WHERE
key_id = 'e13dd3709dc1b26421c45aa22a5ba9fd8f163fa2f49e58636715917daacc65a4'
AND (
token = 'owaG3cV7DvmRNfNq/iV1jcC7ETlt0vO5w5nxee2cnP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)