UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IALKvJ4J5ENwP1azVmFnQofMyRDU+OhzeeB71xfeJMA=' 
WHERE 
  key_id = '6690e315fd514e7d437372d9c43e5ee2cecf70e1fd0eb38685138e69ce365eca' 
  AND (
    token = 'IALKvJ4J5ENwP1azVmFnQofMyRDU+OhzeeB71xfeJMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017