UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CiMMs0wdUdmH/ejPyGMTShMXs6FC7GzVydUswYqmf7I='
WHERE
key_id = 'b6336092823508c2cb55c50776a90d554f8b6255b64b4cade1133f0ece845c8a'
AND (
token = 'CiMMs0wdUdmH/ejPyGMTShMXs6FC7GzVydUswYqmf7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)