UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FBv78OjTwPEW315vjZKgic9Gpsdl7znGJmo+5+42Sb8=' 
WHERE 
  key_id = '4c3ee276385170f9f2c19402ca657e0dc02d4f8b1bff088405c00632b12c4f8b' 
  AND (
    token = 'FBv78OjTwPEW315vjZKgic9Gpsdl7znGJmo+5+42Sb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027