UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I4CwORn1shTrn02UAIpJuXfDsKlFlMs7EQsv4M5g+fs='
WHERE
key_id = 'ac6bdc4a111e97d2a52c750041071f7ff5e258bf999a4d1ef3e89bec6bc19877'
AND (
token = 'I4CwORn1shTrn02UAIpJuXfDsKlFlMs7EQsv4M5g+fs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)