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