UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+8XJKea33XovI9+pPndIzKpVjhjFGS57Uy2sa6hwYg=' 
WHERE 
  key_id = 'cc93daf2af82911040c89b2b2a75a595e4cbbdf0a044a4bfae49a5d2121d6ab6' 
  AND (
    token = 'B+8XJKea33XovI9+pPndIzKpVjhjFGS57Uy2sa6hwYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021