UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEhLLIJujuELqRyvH4EmV8ncVXRB++KrM9+FAL6lFII=' 
WHERE 
  key_id = 'fb5259fb30e5e873c0b14c1df2655ae8857073575ea31f089f96800e3b2547b3' 
  AND (
    token = 'wEhLLIJujuELqRyvH4EmV8ncVXRB++KrM9+FAL6lFII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023