UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bISX7w7drTeL7wIexTs1rpYqaQfuSPfwDTxAfst1sEg='
WHERE
key_id = 'c0b7edf2b2bb3983c4c7434e2f167704bf0f89612c1697910cadd4fdc9bf366f'
AND (
token = 'bISX7w7drTeL7wIexTs1rpYqaQfuSPfwDTxAfst1sEg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)