UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ayz7GyNHHi9cZ8F4LQ7TcyOvC+dW0fuik2kZYBIcOqs='
WHERE
key_id = '99dcafb20e17a287660d8b9d613673c13a4d1c52d5a6ff170a67c31eb668713f'
AND (
token = 'Ayz7GyNHHi9cZ8F4LQ7TcyOvC+dW0fuik2kZYBIcOqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)