UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a0T+Jt5nRDKRizjf6rtul/ztPLKCuWq8qgFFlhDET20='
WHERE
key_id = 'b86e39b2d1aafb864e34938a187912650dd656e0831939df011d6994e8bce87b'
AND (
token = 'a0T+Jt5nRDKRizjf6rtul/ztPLKCuWq8qgFFlhDET20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)