UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GY7i3iP9AS+W2LG5tTpyefFu6oPG3KrgoHJ8M9gNyKE=' 
WHERE 
  key_id = '0767cf50fb0496be6c9986348a796a466080feb09db1914b31d770739e061650' 
  AND (
    token = 'GY7i3iP9AS+W2LG5tTpyefFu6oPG3KrgoHJ8M9gNyKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052