UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BJm4acmUw4a+0Lg6zMGbjfAiuAwG+QOLWeRo787wJtI='
WHERE
key_id = 'ff50d60b921ae8a54803d25b349375117e867502712749de4f39df164410881b'
AND (
token = 'BJm4acmUw4a+0Lg6zMGbjfAiuAwG+QOLWeRo787wJtI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)