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