UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wjqx8JrxVpqXkco99OY8AuohodCD/ohZH0mGBmo+G+w='
WHERE
key_id = 'f313a95a5aadfd015537f108bfd9f33de24657b0c7891b306d260e2da9185c40'
AND (
token = 'wjqx8JrxVpqXkco99OY8AuohodCD/ohZH0mGBmo+G+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)