UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'svs+1tcN+DyFOL7kPBBdXINHGoqwaFPz5EgElYClO3A=' 
WHERE 
  key_id = 'ffb0b505a1af5d0878ba8999c0502b51fda27d8044cf57d29e16f4ceb781f469' 
  AND (
    token = 'svs+1tcN+DyFOL7kPBBdXINHGoqwaFPz5EgElYClO3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052