UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i+Y3kc8U98E+eXl2rCPJRHfM9vlXHhpEmpXq78ri03A=' 
WHERE 
  key_id = '71642f043d00d039a9703c6ea948d3c7135c18389e18b0527bf200c9c955e0ec' 
  AND (
    token = 'i+Y3kc8U98E+eXl2rCPJRHfM9vlXHhpEmpXq78ri03A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038