UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3wb7eYrujFLIrS5mJ2+Y036K+d7XG6ssApasQOtmLH8=' 
WHERE 
  key_id = 'f65427ef3d52dc483595541bbbef635853d7f346222cbf15e12f0c0767961c20' 
  AND (
    token = '3wb7eYrujFLIrS5mJ2+Y036K+d7XG6ssApasQOtmLH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038