UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ygrgLcI7md8Jked+1MQGOjx6ffD8uKiAlaMG70cwLB8='
WHERE
key_id = 'c0a70c5c821b718747d74a7203749dbf9dd8fd8266ed2a0ae0e882851c08deaa'
AND (
token = 'ygrgLcI7md8Jked+1MQGOjx6ffD8uKiAlaMG70cwLB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)