UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G1UYs6tNd0XQyQv6XzGf5KopIo7xcq9sl4zsWom0U64=' 
WHERE 
  key_id = '29541728f25961204e96cff3b58b13afc94e20155c53206abb74b1898a98d444' 
  AND (
    token = 'G1UYs6tNd0XQyQv6XzGf5KopIo7xcq9sl4zsWom0U64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052