UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uX9kDDO68146+GmY63gaWEe1bUZTIWCyreA9F1HdCt0='
WHERE
key_id = 'a18b83465f2e3bdb5581338c7e518ed23c55480e3748d165607503c8bd7b7527'
AND (
token = 'uX9kDDO68146+GmY63gaWEe1bUZTIWCyreA9F1HdCt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)