UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZwDkPkvyb0YzWwSVCyx0hkmBB8AL6our+X/Cpry0Z+A='
WHERE
key_id = 'd7925e86245e530452a911ba594e6b87d8cf5954782e988601888ea9a3a2cbff'
AND (
token = 'ZwDkPkvyb0YzWwSVCyx0hkmBB8AL6our+X/Cpry0Z+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)