UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e3lFmuSFG7TtKA0FbpNOZIL1rw66mUvJwiTgc1eHxbk='
WHERE
key_id = '15ca2bb30b9e716ad54362031659bde3e2ea1bc0910e2a1c56a85647fe2c89b5'
AND (
token = 'e3lFmuSFG7TtKA0FbpNOZIL1rw66mUvJwiTgc1eHxbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)