UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jRyvKUJnQSVJKB47y1iCrxWCFZiFAjMjMw4EnVoLmZM='
WHERE
key_id = '58eee09f2a576c99665b795667ea3d1f697b98ec15a805e5e9fa2a2d1ed69354'
AND (
token = 'jRyvKUJnQSVJKB47y1iCrxWCFZiFAjMjMw4EnVoLmZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)