UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rBTAXlmRyatqGbsJ4owAswXKAG5jFe30uIwDiY/0KhA='
WHERE
key_id = 'a2b8177d04459e09c25c5ef93c9b369cc5599e3c68beae2de9b0b8058e825d5b'
AND (
token = 'rBTAXlmRyatqGbsJ4owAswXKAG5jFe30uIwDiY/0KhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)