UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f9A8tiukZfjT1gZGW0fJUbyPhLDDmDs31T3w1yAYasI=' 
WHERE 
  key_id = 'b032510e93f8c16fdc92da2533e54a3f5cbfd11f2ba51eb15f27e95bb136a2f1' 
  AND (
    token = 'f9A8tiukZfjT1gZGW0fJUbyPhLDDmDs31T3w1yAYasI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036